Don't try to snapshot invisible icons
authorTimm Bäder <mail@baedert.org>
Mon, 9 Oct 2017 15:38:54 +0000 (17:38 +0200)
committerTimm Bäder <mail@baedert.org>
Tue, 10 Oct 2017 07:49:35 +0000 (09:49 +0200)
These spew criticals when width == 0 || height == 0.

gtk/gtkicon.c
gtk/gtkpaned.c
gtk/gtkrendericon.c

index aefd1c7f8a9bdca628bbf9bba2178e3f1631fe29..5424e15ee2d05a426ad3d18da9e5ae5f65ab4936 100644 (file)
@@ -43,10 +43,11 @@ gtk_icon_snapshot (GtkWidget   *widget,
 
   gtk_widget_get_content_size (widget, &width, &height);
 
-  gtk_css_style_snapshot_icon (style,
-                               snapshot,
-                               width, height,
-                               self->image);
+  if (width > 0 && height > 0)
+    gtk_css_style_snapshot_icon (style,
+                                 snapshot,
+                                 width, height,
+                                 self->image);
 }
 
 static void
index a759190c011fd187b3ad3ff05913762727c2836f..7af1076745f57793ea6504a16e6140354c2c0e5c 100644 (file)
@@ -1476,10 +1476,11 @@ gtk_paned_render_handle (GtkGizmo    *gizmo,
 
   gtk_widget_get_content_size (widget, &width, &height);
 
-  gtk_css_style_snapshot_icon (style,
-                               snapshot,
-                               width, height,
-                               GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR);
+  if (width > 0 && height > 0)
+    gtk_css_style_snapshot_icon (style,
+                                 snapshot,
+                                 width, height,
+                                 GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR);
 
   return FALSE;
 }
index 3cecd35c004a28202359d41c287a22412255d939..caa700568fecf6e86d7bd8f7d6673be5422df61e 100644 (file)
@@ -105,6 +105,9 @@ gtk_css_style_snapshot_icon (GtkCssStyle            *style,
   g_return_if_fail (GTK_IS_CSS_STYLE (style));
   g_return_if_fail (snapshot != NULL);
 
+  if (width == 0.0 || height == 0.0)
+    return;
+
   image = _gtk_css_image_value_get_image (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_ICON_SOURCE));
   if (image == NULL)
     return;